function [correct_p]=dividep(liyi160_index,duan160_index,p160)
correct_p=double.empty(0,2);
p1=all(liyi160_index);
p2=all(duan160_index);
if p1==0 && p2==0
    correct_p=p160(:,1);
    a=polyfit(p160(:,1),p160(:,2),2);
    correct_p(:,2)=polyval(a,correct_p(:,1));
end
if (p1==0)&&(p2~=0)
    [duanhang,duanlie]=size(duan160_index);
    if duanhang>1
        al=p160(1:(duan160_index(1)-1),:);
        correct_p=al(:,1);
        a=polyfit(al(:,1),al(:,2),2);
        correct_p(:,2)=polyval(a,correct_p(:,1));
        for i=2:duanhang
            if i==duanhang
                cl=p160(duan160_index(1):(duan160_index(2)-1),:);
                cl2=p160(duan160_index(2):end,:);
                 ccl=polyfit(cl(:,1),cl(:,2),2);
                 cl(:,2)=polyval(ccl,cl(:,1));
                 ccl2=polyfit(cl2(:,1),cl2(:,2),2);
                 cl2(:,2)=polyval(ccl2,cl2(:,1));
                 correct_p=[correct_p;cl];
                 correct_p=[correct_p;cl2];  
            else
               cl=p160(duan160_index(1):(duan160_index(2)-1),:); 
                ccl=polyfit(cl(:,1),cl(:,2),2);
                 cl(:,2)=polyval(ccl,cl(:,1));
                 correct_p=[correct_p;cl];
            end
        end
    else
        al=p160(1:duan160_index(1)-1,:);
        al2=p160(duan160_index(1):end,:);
         aal=polyfit(al(:,1),al(:,2),2);
         al(:,2)=polyval(aal,al(:,1));
         aal2=polyfit(al2(:,1),al2(:,2),2);
         al2(:,2)=polyval(aal2,al2(:,1));
         correct_p=[correct_p;al];
         correct_p=[correct_p;al2]; 
    end
end
if   (p1~=0)&&(p2==0)
    [duanhang,duanlie]=size(liyi160_index);
    if duanhang>1
        al=p160(1:(liyi160_index(1)-1),:);
        correct_p=al(:,1);
        a=polyfit(al(:,1),al(:,2),2);
        correct_p(:,2)=polyval(a,correct_p(:,1));
        for i=2:duanhang
            if i==duanhang
                cl=p160((liyi160_index(1)+1):(liyi160_index(2)-1),:);
                cl2=p160(liyi160_index(2)+1:end,:);
                 ccl=polyfit(cl(:,1),cl(:,2),2);
                 cl(:,2)=polyval(ccl,cl(:,1));
                 ccl2=polyfit(cl2(:,1),cl2(:,2),2);
                 cl2(:,2)=polyval(ccl2,cl2(:,1));
                 correct_p=[correct_p;cl];
                 correct_p=[correct_p;cl2];     
            else
               cl=p160(duan160_index(1):(duan160_index(2)-1),:); 
                ccl=polyfit(cl(:,1),cl(:,2),2);
                 cl(:,2)=polyval(ccl,cl(:,1));
                 correct_p=[correct_p;cl];
            end
        end
    else
        al=p160(1:liyi160_index(1)-1,:);
        al2=p160(liyi160_index(1)+1:end,:);
         aal=polyfit(al(:,1),al(:,2),2);
         al(:,2)=polyval(aal,al(:,1));
         aal2=polyfit(al2(:,1),al2(:,2),2);
         al2(:,2)=polyval(aal2,al2(:,1));
         correct_p=[correct_p;al];
         correct_p=[correct_p;al2]; 
    end
end
end